package com.layui.common;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;

import com.layui.utils.IdGen;

import lombok.Data;

/**
 * 公共类
 *
 * @author LiShuai
 * @date 2019年2月24日
 */
@MappedSuperclass
@Data
public class BaseEntity implements Serializable {

	private static final long serialVersionUID = 2890958715739604606L;

	// 用户id
	@Id
	@Column(length = 20)
	private String id;

	@PrePersist
	public void prePersist() {
		this.id = IdGen.uuid();
	}

	@Column(columnDefinition = "varchar(64) DEFAULT NULL COMMENT '名称'")
	private String name;

	@Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '备注'")
	private String remark;

	// 数据状态
	private Byte status = StatusEnum.OK.getCode();

}
